package com.crm.service.impl.knowledgeitem;

import com.crm.dao.mapper.customMapper.knowledgeitem.KnowledgeSectionCustomMapper;
import com.crm.dao.mapper.knowledgeitem.KnowledgeSectionMapper;
import com.crm.model.entity.knowledgeitem.KnowledgeSection;
import com.crm.model.vo.knowledgeitem.KnowledgeSectionVO;
import com.crm.service.knowledgeitem.KnowledgeSectionDbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * @Description: 知识章节
 * @Author lixq-f
 * @Date 2021/5/7
 * @Version V1.0
 **/
@Service
public class KnowledgeSectionDbServiceImpl implements KnowledgeSectionDbService {


    @Autowired
    private KnowledgeSectionMapper sectionMapper;
    @Autowired
    private KnowledgeSectionCustomMapper sectionCustomMapper;

    @Override
    public Boolean insert(KnowledgeSection record) {
        return sectionMapper.insert(record) > 0;
    }

    @Override
    public Boolean update(KnowledgeSection record) {
        return sectionMapper.updateByPrimaryKeySelective(record) > 0;
    }

    @Override
    public List<KnowledgeSectionVO> selectListByKnItemId(String itemId) {
        return sectionCustomMapper.selectListByKnItemId(itemId);
    }


    @Override
    public Boolean deleteById(String sectionId, short deleteStatus) {
        return sectionCustomMapper.deleteById(sectionId, deleteStatus);
    }


    @Override
    public Boolean deleteByItemId(String itemId, short deleteStatus) {
        return sectionCustomMapper.deleteByItemId(itemId, deleteStatus);
    }

    @Override
    public KnowledgeSection selectKnSectionByKey(String sectionId) {
        return sectionMapper.selectByPrimaryKey(sectionId);
    }


}
